#include "ConfigFile.h"
#include <stdlib.h>

bool ConfigFile::Load(const std::string& filename)
{
	/*
	if(!m_file.OpenRead(filename))
		{
			return false;
		}
	
		const char* s;
		while (m_file.GetDataLine(s))
		{
			unsigned int pos = s->find('=');
			if (pos != std::string::npos)
			{
				std::string key = s.substr(0, pos);
				std::string value = s.substr(pos + 1);
				m_map[key] = value;
	
			}
		}*/
	
	return true;
}

int ConfigFile::GetInt(const std::string& key)
{
	std::string intString = GetString(key);
	return atoi(intString.c_str());
}

float ConfigFile::GetFloat(const std::string& key)
{
	std::string floatString = GetString(key);
	return (float)atof(floatString.c_str());
}

std::string ConfigFile::GetString(const std::string& key)
{
	ConfigMap::iterator it = m_map.find(key);
	if(it != m_map.end())
	{
		return it->second;
	}
}

bool ConfigFile::EndOfFile()
{
	return true;
}